<template>
  <div>
    <!-- <p>{{ carList }}</p> -->
    <h2>购物车</h2>
    <div class="center">
      <div v-for="(item, index) in carList.data.data" :key="index">
        <span class="inp"></span>
        <div class="list">
          <span class="left">
            <img :src="item.shopdata.cover" alt="" />
          </span>
          <span class="right">
            <span class="name">
              {{ item.shopdata.name }}
            </span>
            <span class="stock">累计{{ item.shopdata.stock }}份</span>
            <span class="price"
              >￥<span class="num">{{ item.shopdata.price }}</span>
              <span class="addandjian">
                <span class="jian">-</span
                ><span class="count">{{ item.count }}</span
                ><span class="jia">+</span>
              </span>
            </span>
          </span>
        </div>
      </div>
    </div>

    <div class="bottom">
      <input type="checkbox" />
      <span class="all">全选</span>
      <span class="zong">总价：<span class="zongnum">￥100</span></span>
      <span class="submit">结算</span>
    </div>
  </div>
</template>

<script>
import { mapActions, mapState } from "vuex";
export default {
  data() {
    return {};
  },
  computed: {
    ...mapState("car", ["carList"]),
  },
  created() {
    this.getCarActions();
  },
  methods: {
    ...mapActions("car", ["getCarActions"]),
  },
};
</script>

<style scoped>
.center {
  height: calc(100vh - 130px);
  overflow: auto;
}
.inp {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 1px solid #ccc;
  border-radius: 50%;
  float: left;
  margin-top: 45px;
  margin-left: 10px;
}
.list {
  overflow: hidden;
  margin-top: 0px;
}
img {
  width: 100px;
  height: 100px;
  float: left;
}
.right {
  display: flex;
  flex-direction: column;
  padding-left: 5px;
}
.name {
  font-weight: bold;
  margin-top: 10px;
  margin-bottom: 10px;
}
.stock {
  font-size: 10px;
  color: #ccc;
  margin-bottom: 5px;
  margin-top: 5px;
}
.price {
  color: red;
  font-size: 10px;
  margin-bottom: 5px;
  margin-top: 5px;
}
.num {
  font-size: 17px;
  font-weight: bold;
}
.car {
  float: right;
  font-size: 17px;
  margin-right: 15px;
}
.addandjian {
  float: right;
  font-size: 17px;
  margin-right: 20px;
}
.count {
  margin-left: 10px;
  margin-right: 10px;
}
.jia {
  font-size: 20px;
}
.jian {
  font-size: 22px;
}
.bottom {
  position: fixed;
  bottom: 55px;
  height: 30px;
  line-height: 30px;
}
.all {
  font-size: 16px;
  margin-left: 10px;
  margin-right: 70px;
}
.zong {
  font-size: 16px;
  margin-right: 40px;
}
.zongnum {
  font-size: 18px;
  color: red;
}
.submit {
  display: inline-block;
  width: 100px;
  height: 30px;
  background-color: red;
  color: white;
  text-align: center;
  font-size: 16px;
  border-radius: 20px;
}
h2 {
  text-align: center;
  width: 100%;
  border-bottom: 1px solid #ccc;
  padding-bottom: 10px;
  margin-bottom: 0px;
}
</style>